package com.ccx.coachsite.bus;
import com.ccx.coachsite.http.BaseResp;
import com.ccx.coachsite.task.RepasswordTask;
import com.ccx.coachsite.ui.own.OwerMoreRepasswordView;

import android.app.Activity;
import android.content.Context;

public class RepasswordBus extends BaseBus {
	
	private OwerMoreRepasswordView mOwerMoreRepasswordView;
	
	public RepasswordBus(Activity activity) {
		super(activity, "正在提交...");
		successInfo = "修改密码成功";
		errorInfo = "修改密码失败";
	}
	
	public RepasswordBus(Context context, OwerMoreRepasswordView owerMoreRepasswordView) {
		super(context);
		this.mOwerMoreRepasswordView =  owerMoreRepasswordView;
		processInfo = "正在提交...";
		successInfo = "修改密码成功";
		errorInfo = "修改密码失败";
	}
	
	protected void onCallback(boolean isSucces, int taskType, BaseResp response, String responseJson)
	{
		if(isSucces)
		{
			if(mOwerMoreRepasswordView != null)
				mOwerMoreRepasswordView.setEmpty();
		}
	}

	public void changePassword(Account account, String newPwd, String oldPwd, String code) {
		showProgress();
		RepasswordTask task = new RepasswordTask(this, mContext);
		task.setParams(account, oldPwd, newPwd, code);
		task.execute();
	}
}